//
//  BaseTabBarController.m
//  SWS
//
//  Created by zjszyms on 16/1/12.
//  Copyright © 2016年 zjszyms. All rights reserved.
//

#import "BaseTabBarController.h"

#import "BaseNavigationController.h"

#import "HomeVC.h"
#import "TweetVC.h"
#import "DiscoverVC.h"
#import "MineVC.h"

@interface BaseTabBarController ()

@end

@implementation BaseTabBarController

- (id)init
{
    self = [super init];
    if (self) {
        [self initialization];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

-(void)initialization
{
    UIViewController *homeVC     = [[HomeVC alloc] init];
    UIViewController *tweetVC    = [[TweetVC alloc] init];
    UIViewController *discoverVC = [[DiscoverVC alloc] init];
    UIViewController *mineVC     = [[MineVC alloc] init];
    
    BaseNavigationController *homeNv     = [[BaseNavigationController alloc] initWithRootViewController:homeVC];
    BaseNavigationController *tweetNv    = [[BaseNavigationController alloc] initWithRootViewController:tweetVC];
    BaseNavigationController *discoverNv = [[BaseNavigationController alloc] initWithRootViewController:discoverVC];
    BaseNavigationController *mineNv     = [[BaseNavigationController alloc] initWithRootViewController:mineVC];
    self.viewControllers = @[homeNv, tweetNv, discoverNv, mineNv];
    
    NSArray *titleArray    = @[@"首页", @"动弹", @"发现", @"我的"];
    NSArray *imageArray    = @[@"tab_btn1", @"tab_btn2", @"tab_btn3", @"tab_btn4"];
    NSArray *selectedArray = @[@"tab_btn1_selected", @"tab_btn2_selected", @"tab_btn3_selected", @"tab_btn4_selected"];
    
    for (int i = 0; i < self.tabBar.items.count; i++)
    {
        UITabBarItem *barItem = self.tabBar.items[i];
        barItem.title = titleArray[i];
        barItem.image = [UIImage imageNamed:imageArray[i]];
        barItem.selectedImage = [UIImage imageNamed:selectedArray[i]];
    }
}

- (void)dealloc
{
    NSLog(@"BaseTabBarController dealloc");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
